package com.example.keli.ui.home.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.keli.R;
import com.example.keli.base.utils.GlideUtil;
import com.example.keli.ui.home.model.GoodActorData;

import java.util.List;

/**
 * description:优秀作品
 * author: Allen
 * date: 2019/3/19 11:51
 */
public class GoodActorAdapter extends BaseQuickAdapter<GoodActorData.DataBean, BaseViewHolder> {
//    int width = 173 * 2;
//    int height = 220 * 2;
    RelativeLayout.LayoutParams layoutParams;
    public GoodActorAdapter(List<GoodActorData.DataBean> mData, Context context) {
        super(R.layout.item_good_actor, mData);
//        width = (ScreenUtil.getScreenWidth(context) - DensityUtil.dip2px(context, 24));
//        height = width ;
//        layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,height);
//        layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, -1);
//        layoutParams.leftMargin = DensityUtil.dip2px(context,12);
//        layoutParams.topMargin = DensityUtil.dip2px(context,12);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodActorData.DataBean mListBean) {
        helper.setText(R.id.nick_name, mListBean.getNickname());
        helper.setText(R.id.age, mListBean.getAge()+"岁");
        ImageView cover = helper.getView(R.id.cover);
//        CardView cardView = helper.getView(R.id.layout);
//        cardView.setLayoutParams(layoutParams);
        String[] images = mListBean.getImg().split(",");
        if (images.length > 0){
            GlideUtil.displayRound(cover.getContext(), cover, images[0],3);
        }
    }

}
